NDepend.API Documentation
ToHashSet<T>(IEnumerable<T>,IEqualityComparer<T>) Method
NDepend.Helpers Namespace > ExtensionMethodsSet Class > ToHashSet Method : ToHashSet<T>(IEnumerable<T>,IEqualityComparer<T>) Method
The type of the elements of seq.
An IEnumerable<T> to create an hashset from.
The equality comparer on elements.
Creates an hashset from a IEnumerable<T>.
Syntax
[Obsolete("Use ToHashSetEx() extension method instead to avoid conflict with the .NET Fx v4.7.2 ToHashSet() extension method with same signature")]
[Extension()]
public static HashSet<T> ToHashSet<T>( 
   IEnumerable<T> seq,
   IEqualityComparer<T> equalityComparer
)

Parameters

seq
An IEnumerable<T> to create an hashset from.
equalityComparer
The equality comparer on elements.

Type Parameters

T
The type of the elements of seq.

Return Value

An hashset that contains the elements from the input sequence.
Remarks
The .NET Fx v4.7.2 introduces a ToHashSet() extension method with the same signature. As a consequence this method has been marked as obsolete since NDepend v2018.1.1 and it is advised to use ToHashSetEx<T>(IEnumerable<T>,IEqualityComparer<T>) instead, to avoid ambiguous call error emitted by the compiler.
Requirements

Target Platforms: Windows 11, 10, 8, 7 and Linux, MacOS with net8.0, net7.0 or net6.0 installed

See Also

Reference

ExtensionMethodsSet Class
ExtensionMethodsSet Members
Overload List